package com.yuandian.customer.perception.controller;

import com.yuandian.api.customer_perception.po.KhgzSystemParams;
import com.yuandian.api.customer_perception.po.LowFrequenceSystemParams;
import com.yuandian.api.customer_perception.po.SystemOverviewParams;
import com.yuandian.api.customer_perception.vo.SystemOverview;
import com.yuandian.bpm.common.core.util.R;
import com.yuandian.customer.perception.service.ILowFrequencySysOverviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 低频受理-系统概况 controller
 * @author: yanjun
 * @date: 2021/04/15
*/
@RestController
@RequestMapping("/lowfrequency/system")
public class LowFrequencySysOverviewController {

	@Autowired
	private ILowFrequencySysOverviewService sysOverviewService;

	/**
	 * 查询系统域和对应系统组成下拉框数据源
	 *
	 * @param params 请求对象
	 * @return
	 */
	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public R<Object> list(SystemOverviewParams params) {
		// 因为需要组成下拉框所以不需对系统下拉列表进行过滤
		if (params.getSystemId() != null && params.getSystemId() > 0) {
			params.setSystemId(null);
		}
 		List<SystemOverview> list = sysOverviewService.querySystemOverviewOptions();
		return R.ok(list);
	}

	/**
	 * 查询低频受理系统概况列表
	 * @param params 请求对象
	 * @return 通用返回对象
	 */
	@RequestMapping(value = "/listData", method = RequestMethod.POST)
	public R<Object> listData(@RequestBody LowFrequenceSystemParams params) {
		return R.ok(sysOverviewService.querySystemOverviewList(params));
	}


	/**
	 * 查询系统列表
	 * @param params 请求对象
	 * @return 通用返回对象
	 */
	@RequestMapping(value = "/getSystemListByDomain", method = RequestMethod.GET)
	public R<Object> getSystemListByDomain(KhgzSystemParams params) {
		return R.ok(sysOverviewService.getSystemListByDomain(params));
	}

}
